package me.fung.rem.component.swing

import javax.swing.JFileChooser
import javax.swing.filechooser.FileNameExtensionFilter


fun chooseFile( fileSelectionModel: Int = JFileChooser.FILES_ONLY): String? {
    val chooser = JFileChooser( ".file").apply {
        this.fileSelectionMode = fileSelectionModel
//        addChoosableFileFilter(FileNameExtensionFilter("文本文件 *.txt *.dic", "txt", "dic"))
    }
    val state = chooser.showOpenDialog(null)
    if (state != JFileChooser.APPROVE_OPTION) return null
    return chooser.selectedFile?.absoluteFile?.absolutePath
}
